import { defineStore } from 'pinia';
import storage from '@/utils/storage';
export const useAppStore = defineStore('app', {
  state() {
    return {
      isCollapse: storage.get('isCollapse', false) == '1' ? true : false,
      menuType: (storage.get('menuType', false) || 0) as number,
    };
  },
  getters: {},
  actions: {
    toggleMenuType() {
      const type = this.menuType == 1 ? 0 : 1;
      storage.set('menuType', type);
      this.menuType = type;
    },
    toggleCollapse() {
      this.isCollapse = !this.isCollapse;
      const type = this.isCollapse ? '1' : '0';
      storage.set('isCollapse', type);
    },
  },
});
